package com.learn.controller;

import com.learn.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author DJJ_F
 * @version 1.0
 * @date 2025/01/26
 * @description
 */
@Controller
public class RestfulController {
    @RequestMapping(value = "/user", method = RequestMethod.GET)
    public String getAllUser() {
        System.out.println("get all users");
        return "ok";
    }
    @GetMapping("/user/{id}")
    public String getUserById(@PathVariable("id") Integer id) {
        System.out.println("id: " + id);
        return "ok";
    }
    @PostMapping("/user")
    public String saveUser(User user) {
        System.out.println("save user: " + user);
        return "ok";
    }
    @PutMapping("/user")
    public String updateUser(User user) {
        System.out.println("update user:" + user);
        return "ok";
    }
    @DeleteMapping("/user/{id}")
    public String getAllUser(@PathVariable("id") Integer id) {
        System.out.println("delete user: " + id);
        return "ok";
    }
}
